package web.stu.model.vo;

import cn.hutool.core.bean.BeanUtil;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import web.stu.model.entity.ScoreAudit;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;

@Data
public class ScoreAuditVO implements Serializable {

    private static final long serialVersionUID = 1L;

    /**
     * id
     */
    private Integer id;

    /**
     * 成绩表id
     */
    private Integer scoreId;

    /**
     * 审核人Id
     */
    private Integer adminId;

    /**
     * 审核人姓名
     */
    private String auditName;

    /**
     * 审核状态
     */
    private Integer status;

    /**
     * 旧成绩
     */
    private BigDecimal oldScore;

    /**
     * 新成绩
     */
    private BigDecimal newScore;

    /**
     * 审核原因
     */
    private String reason;

    /**
     * 创建时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date createTime;

    /**
     * 更新时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date updateTime;

    /**
     * 成绩实体类
     */
    private ScoreVO scoreVO;


    public static ScoreAuditVO objToVO(ScoreAudit scoreAudit) {
        // 非空判断
        if (scoreAudit == null) {
            return null;
        }
        ScoreAuditVO scoreAuditVO = BeanUtil.copyProperties(scoreAudit, ScoreAuditVO.class);
        return scoreAuditVO;
    }


    public static ScoreAudit voToObj(ScoreAuditVO scoreAuditVO) {
        // 非空判断
        if (scoreAuditVO == null) {
            return null;
        }
        ScoreAudit scoreAudit = BeanUtil.copyProperties(scoreAuditVO, ScoreAudit.class);
        return scoreAudit;
    }


}
